package com.search;

import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;

import java.util.concurrent.TimeUnit;

public class CaffeineDemo {
    public static void main(String[] args) throws InterruptedException {
        Cache<String,String> cache = Caffeine.newBuilder().expireAfterWrite(1000, TimeUnit.MILLISECONDS).build();
        cache.put("aaa","ttt");
        Thread.sleep(20);
        String res = cache.getIfPresent("aaa");
        System.out.println(res);
        String entityStr = "{\"libcode\":\"STL50\",\"channel\":\"yuntu-wx-mini\",\"timestamp\":1723188990207,\"salt\":448928,\"sign\":\"edfaefb1fc3058a1ca43f651c8c88d17\",\"bizParam\":{\"pageNo\":1,\"pageSize\":15,\"keyword\":\"9787532499397\",\"holdingStatus\":0,\"searchType\":1}}";
        System.out.println(entityStr.indexOf("sign"));
        String sub = entityStr.substring(entityStr.indexOf("sign")+7,entityStr.indexOf("sign")+39);
        System.out.println(sub);
        entityStr = entityStr.replace(sub,"atasgtgasdgtarsgtrsrgtre");
        System.out.println(entityStr);
        String test = "0123456789";
        System.out.println(test.substring(3,7));

    }
}
